package Solution

import (
	"reflect"
	"strconv"
	"testing"
)

func TestSolution(t *testing.T) {
	//	测试用例
	cases := []struct {
		name                string
		values, labels      []int
		numWanted, useLimit int
		expect              int
	}{
		{"TestCase1", []int{5, 4, 3, 2, 1}, []int{1, 1, 2, 2, 3}, 3, 1, 9},
		{"TestCase2", []int{5, 4, 3, 2, 1}, []int{1, 3, 3, 3, 2}, 3, 2, 12},
		{"TestCase3", []int{9, 8, 8, 7, 6}, []int{0, 0, 0, 1, 1}, 3, 1, 16},
	}

	//	开始测试
	for i, c := range cases {
		t.Run(c.name+" "+strconv.Itoa(i), func(t *testing.T) {
			got := Solution(c.values, c.labels, c.numWanted, c.useLimit)
			if !reflect.DeepEqual(got, c.expect) {
				t.Fatalf("expected: %v, but got: %v, with inputs: %v %v %v %v",
					c.expect, got, c.values, c.labels, c.numWanted, c.useLimit)
			}
		})
	}
}

// 压力测试
func BenchmarkSolution(b *testing.B) {
}

// 使用案列
func ExampleSolution() {
}
